<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../../init.jsp"%>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>新增</title>
    <jsp:include page="../../common/css-js.jsp" flush="true" />
</head>
<body>
	<div class="form p20">
		<form id="${tableSubName?uncap_first}">
			<#list columns as d>
			<#if d.pk == d.colName><input name="${pkName}" type="hidden" value=""></#if><#if d.pk != d.colName && d.colName!='created' && d.colName!='status'>
			<div class="form-group">
				<label class="form-label"><span class="must">*</span><#if d.remark != ''>${d.remark}</#if><#if d.remark == ''>${d.colName}</#if>：</label>
				<div class="form-block-box">
					<input name="${d.colName}" autocomplete="off" type="text" class="form-input"
					data-validation-engine="validate[required]" data-errormessage-value-missing="请输入${d.remark}">
				</div>
			</div></#if></#list>
			<div class="btn-bottom-out">
		        <div class="btn-bottom btn-operation">
		        <Auth:show mcode="${tablePrefix}-${tableSubName?lower_case}-add">
		            <button class="btn" type="button" onclick="submitFrom()">保存</button>
		        </Auth:show>
		            <button class="btn btn-primary" type="button" onclick="closeLayer()">取消</button>
		        </div>
		    </div>
		</form>
	</div>
<script>
function submitFrom() {
	validationEngineInit('${tableSubName?uncap_first}');
	if($('#${tableSubName?uncap_first}').validationEngine('validate')){
		var dataForm = $("#${tableSubName?uncap_first}").serialize();
		var index = parent.layer.getFrameIndex(window.name);<#if (saveorupdate=='true')>
		httpPost('${path}${requestPrefix}/${tableSubName?uncap_first}/saveOrUpdate.htm',dataForm,function(result){
			parent.layer.msg(result.msg);
			parent.model.load();
			parent.layer.close(index);
		});</#if><#if (saveorupdate=='false')>
		httpPost('${path}${requestPrefix}/${tableSubName?uncap_first}/save.htm',dataForm,function(result){
			parent.layer.msg(result.msg, {icon: 6});
			parent.model.load();
			parent.layer.close(index);
		});</#if>
	}
}
</script>
</body>
</html>
